changeLoginType();
/**
 * @title 切换登录方式
 */
function changeLoginType() {
    var lastTarget = 'login-box';
    $('.login-tab').on('click',function () {
        var targetClass = $(this).data('target');
        if(lastTarget == targetClass){
            return true;
        }
        if(targetClass == 'qrcode-login'){
            makeCode();
            showCodeHelp();
        }
        lastTarget = targetClass;
        $('.tab-pane').hide('slow');
        $('.'+targetClass).show('slow');
    });
}

/**
 * 鼠标经过二维码显示帮助
 */
function showCodeHelp() {
    $(".qrcode-img").hover(function(){
        $(".qrcode-img").animate({left: '0'}, "slow");
        $(".qrcode-help").fadeIn();
    },function(){
        $(".qrcode-img").animate({"left": "64px"});
        $(".qrcode-help").fadeOut();
    });
}

function  detectCapsLock(event)
{
    var e = event||window.event;
    var keyCode  =  e.keyCode||e.which; // 获取按键的keyCode
    var isShift  =  e.shiftKey ||(keyCode  ==   16 ) || false ;//是否按住shift建
    if (
        ((keyCode >=   65   &&  keyCode  <=   90 )  &&   !isShift)// Caps Lock 打开，且没有按住shift键
        || ((keyCode >=   97   &&  keyCode  <=   122 )  &&  isShift)// Caps Lock 没打开，且按住shift键
    ){
       return true
    }else{
        return  false;
    }
}
